<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../../lib/jquery-3.4.1/jquery-3.4.1.min.js" charset="utf-8"></script>
    <script src="../../js/echarts.min.js" charset="utf-8"></script>
    <!-- <style>
        #main{
            width: 100%;
            height: 100%;
        }
    </style> -->

</head>

<body>

    <!-- <div id="main"></div> -->
    <div id="main" style="width: 600px; height:500px;"></div>
    <script>
        var chartDom = document.getElementById('main');
        var myChart = echarts.init(chartDom);
        var option;
        $.ajax({
            url: "http://localhost:8080/admin/virus/virus/typePie",
            type: "post",
            data: {},
            success: function (result) {
                var arr = result.data.typePie;
                option = {
                    backgroundColor: '',
                    title: {
                        text: '病毒分类比例图',
                        left: 'center',
                        top: 20,
                        textStyle: {
                            color: '#ccc'
                        }
                    },
                    tooltip: {
                        trigger: 'item'
                    },
                    visualMap: {
                        show: true,
                        min: 80,
                        max: 600
                    },
                    series: [
                        {
                            name: 'Access From',
                            type: 'pie',
                            radius: '55%',
                            center: ['50%', '50%'],
                            data: arr
                                .sort(function (a, b) {
                                    return a.value - b.value;
                                }),
                            roseType: 'radius',
                            label: {
                                // color: 'rgba(255, 255, 255, 0.3)'
                                color: 'rgba(0,191,255,128)'
                            },
                            labelLine: {
                                lineStyle: {
                                    // color: 'rgba(255, 255, 255, 0.3)'
                                    color: 'rgba(0,110,120,150)'
                                },
                                smooth: 0.2,
                                length: 50,
                                length2: 20
                            },
                            itemStyle: {
                                color: '#c23531',
                                shadowBlur: 200,
                                shadowColor: 'rgba(0, 0, 0, 0.5)'
                            },
                            animationType: 'scale',
                            animationEasing: 'elasticOut',
                            animationDelay: function (idx) {
                                return Math.random() * 200;
                            }
                        }
                    ]
                };

                myChart.setOption(option);
            }
        })
    </script>
</body>

</html>